package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.apis.admin.AdSensitiveControllerApi;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    AdSensitiveService adSensitiveService;

    @PostMapping("/list")
    @Override
    public ResponseResult findPage(@RequestBody SensitiveDto dto) {
        return adSensitiveService.findPage(dto);
    }

    @PostMapping("/save")
    @Override
    public ResponseResult add(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.add(adSensitive);
    }

    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }

    //    @DeleteMapping("/del/{id}")  前后端联测时 前端页面发送的请求是delete请求
    //  如果按规范来 就是delete 但是我怕以后用其他测试时 不是delete 而我又忘记改 所以直接request吧
    @RequestMapping("/del/{id}")
    @Override
    public ResponseResult del(@PathVariable("id") Integer id) {
        return adSensitiveService.del(id);
    }


}
